// @ts-ignore
import request from '@/utils/request';
import qs from "qs";

/* eslint-disable */

export async function queryRule(params) {
  const limit = params.pageSize;
  const page = params.current;
  const my_params = {
    limit: limit || 30,
    page: page || 1,
  };
  Object.assign(params, my_params);
  delete params.current;
  delete params.pageSize;
  return request('store/storeOwner/list', {
    params,
  });
}

export async function queryDefaultRule(params) {
  return request(`integral/integralRule/scale/${params}`);
}


export async function updateRule(params) {
  return request('store/storeOwner', {
    method: 'PUT',
    data: {
      ...params,
    },
  });
}

export async function addRule(params) {
  return request('store/storeOwner', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function removeRule(payload) {
  return request(`store/storeOwner/${payload}`, {
    method: 'DELETE',
  });
}

export async function queryStore(params) {
  return request('store/store/list', {
    params,
  });
}
export async function salesList(params) {
  return request(`/store/storeOwner/list`, {
    params
  })
}
export async function queryCommodityClass(params) {
  return request('/goods/goodsCategory/list?parent=true', {
    params,
  });
}
export async function exportRefund() {
  return request(
    `store/storeOwner/exportList`, {
      method: 'GET',
      responseType: 'blob'
    },
  );
}
